<div class="panel panel-default">
    <div class="panel-heading">
        <h3 class="panel-title">订单详情</h3>
    </div>
    <div class="panel-body">
        <div class="row">
            <div class="col-md-6">
                <table class="table table-bordered">
                    <tr>
                        <th width="120">订单号：</th>
                        <td>{$row.order_no}</td>
                    </tr>
                    <tr>
                        <th>客户名称：</th>
                        <td>{$row.customer_name}</td>
                    </tr>
                    <tr>
                        <th>客户电话：</th>
                        <td>{$row.customer_phone}</td>
                    </tr>
                    <tr>
                        <th>总数量：</th>
                        <td>{$row.total_quantity}</td>
                    </tr>
                    <tr>
                        <th>订单状态：</th>
                        <td>
                            {switch name="row.status"}
                                {case value="0"}<span class="label label-warning">待生产</span>{/case}
                                {case value="1"}<span class="label label-info">生产中</span>{/case}
                                {case value="2"}<span class="label label-success">已完成</span>{/case}
                            {/switch}
                        </td>
                    </tr>
                    <tr>
                        <th>创建时间：</th>
                        <td>{$row.createtime|date='Y-m-d H:i:s'}</td>
                    </tr>
                    <tr>
                        <th>备注：</th>
                        <td>{$row.remark}</td>
                    </tr>
                </table>
            </div>
            <div class="col-md-6">
                <div class="progress">
                    <div class="progress-bar progress-bar-success" role="progressbar" 
                         style="width: {$row.progress}%;" aria-valuenow="{$row.progress}" 
                         aria-valuemin="0" aria-valuemax="100">
                        {$row.progress}%
                    </div>
                </div>
                <p class="text-muted">生产进度：{$row.progress}%</p>
            </div>
        </div>
    </div>
</div>

<div class="panel panel-default">
    <div class="panel-heading">
        <h3 class="panel-title">订单型号</h3>
    </div>
    <div class="panel-body">
        <table class="table table-bordered table-striped">
            <thead>
                <tr>
                    <th>产品名称</th>
                    <th>型号名称</th>
                    <th>订单数量</th>
                    <th>已分配数量</th>
                    <th>已报工数量</th>
                    <th>进度</th>
                </tr>
            </thead>
            <tbody>
                {volist name="orderModels" id="orderModel"}
                <tr>
                    <td>{$orderModel.model.product.name}</td>
                    <td>{$orderModel.model.name}</td>
                    <td>{$orderModel.quantity}</td>
                    <td>{$orderModel.allocated_quantity}</td>
                    <td>{$orderModel.reported_quantity}</td>
                    <td>
                        <div class="progress" style="margin-bottom: 0;">
                            <div class="progress-bar progress-bar-info" role="progressbar" 
                                 style="width: {$orderModel.progress}%;" aria-valuenow="{$orderModel.progress}" 
                                 aria-valuemin="0" aria-valuemax="100">
                                {$orderModel.progress}%
                            </div>
                        </div>
                    </td>
                </tr>
                {/volist}
            </tbody>
        </table>
    </div>
</div>

<div class="panel panel-default">
    <div class="panel-heading">
        <h3 class="panel-title">分工分配</h3>
    </div>
    <div class="panel-body">
        {notempty name="allocations"}
        <table class="table table-bordered table-striped">
            <thead>
                <tr>
                    <th>产品型号</th>
                    <th>工序</th>
                    <th>员工</th>
                    <th>分配数量</th>
                    <th>已报数量</th>
                    <th>待报数量</th>
                    <th>进度</th>
                    <th>状态</th>
                </tr>
            </thead>
            <tbody>
                {volist name="allocations" id="allocation"}
                <tr>
                    <td>{$allocation.model.product.name} - {$allocation.model.name}</td>
                    <td>{$allocation.process.name}</td>
                    <td>{$allocation.user.nickname}</td>
                    <td>{$allocation.quantity}</td>
                    <td>{$allocation.reported_quantity}</td>
                    <td>{$allocation.remaining_quantity}</td>
                    <td>
                        <div class="progress" style="margin-bottom: 0;">
                            <div class="progress-bar progress-bar-success" role="progressbar" 
                                 style="width: {$allocation.progress}%;" aria-valuenow="{$allocation.progress}" 
                                 aria-valuemin="0" aria-valuemax="100">
                                {$allocation.progress}%
                            </div>
                        </div>
                    </td>
                    <td>
                        {switch name="allocation.status"}
                            {case value="0"}<span class="label label-warning">进行中</span>{/case}
                            {case value="1"}<span class="label label-success">已完成</span>{/case}
                        {/switch}
                    </td>
                </tr>
                {/volist}
            </tbody>
        </table>
        {else/}
        <div class="alert alert-info">
            <i class="fa fa-info-circle"></i> 暂无分工分配记录
        </div>
        {/notempty}
    </div>
</div>

<div class="form-group">
    <div class="col-xs-12">
        <button type="button" class="btn btn-default" onclick="Layer.closeAll();">关闭</button>
    </div>
</div> 